www.gusucode.com > 8:【198-3690】html5响应式网站织梦模板源码 IT网络工作室整站(自适应手机) > 8:【198-3690】html5响应式网站织梦模板源码 IT网络工作室整站(自适应手机)/include/extend.func.php
<?php function litimgurls($imgid=0) { global $lit_imglist,$dsql; //获取附加表 $row = $dsql->GetOne("SELECT c.addtable FROM #@__archives AS a LEFT JOIN #@__channeltype AS c ON a.channel=c.id where a.id='$imgid'"); $addtable = trim($row['addtable']); //获取图片附加表imgurls字段内容进行处理 $row = $dsql->GetOne("Select imgurls From `$addtable` where aid='$imgid'"); //调用inc_channel_unit.php中ChannelUnit类 $ChannelUnit = new ChannelUnit(2,$imgid); //调用ChannelUnit类中GetlitImgLinks方法处理缩略图 $lit_imglist = $ChannelUnit->GetlitImgLinks($row['imgurls']); //返回结果 return $lit_imglist; } function GetOneImgUrl($img,$ftype=1){ if($img <> ''){ $dtp = new DedeTagParse(); $dtp->LoadSource($img); if(is_array($dtp->CTags)){ foreach($dtp->CTags as $ctag){ if($ctag->GetName()=='img'){ $width = $ctag->GetAtt('width'); $height = $ctag->GetAtt('height'); $imgurl = trim($ctag->GetInnerText()); $img = ''; if($imgurl != ''){ if($ftype==1){ $img .= $imgurl; } else{ $img .= '<img src="'.$imgurl.'" width="'.$width.'" height="'.$height.'" />'; } } } } } $dtp->Clear(); return $img; } } //自定义缩略图大小 function thumb($imgurl, $width, $height, $bg = true) { global $cfg_mainsite,$cfg_multi_site; $thumb = eregi("http://",$imgurl)?str_replace($cfg_mainsite,'',$imgurl):$imgurl; list($thumbname,$extname) = explode('.',$thumb); $newthumb = $thumbname.'_'.$width.'_'.$height.'.'.$extname; if(!$thumbname || !$extname || !file_exists(DEDEROOT.$thumb)) return $imgurl; if(!file_exists(DEDEROOT.$newthumb)) { include_once DEDEINC.'/image.func.php'; if($bg==true) { ImageResize(DEDEROOT.$thumb, $width, $height, DEDEROOT.$newthumb); } else { ImageResize(DEDEROOT.$thumb, $width, $height, DEDEROOT.$newthumb); } } $newthumb = mb_ereg_replace(' ','', $newthumb); return $cfg_multi_site=='Y'?$cfg_mainsite.$newthumb:GetOneImgUrl($newthumb); } function replaceurl($newurl) { global $cfg_mainsite,$cfg_multi_site; $newurl=str_replace('src="/uploads/allimg/','src="'.$cfg_mainsite.'/uploads/allimg/',$newurl); return $newurl; }